package org.budo.validation.exception;

import javax.validation.constraints.NotNull;

/**
 * @author lmw
 */
public class BudoNotNullValidationException extends AbstractBudoValidationException {
    private static final long serialVersionUID = 4969260450165845737L;

    private static final String MESSAGE_DEFAULT = "{javax.validation.constraints.NotNull.message}";

    public BudoNotNullValidationException() {}

    public BudoNotNullValidationException(Integer parameterIndex, String parameterName, NotNull annotation, Object parameterValue) {
        super(parameterIndex, parameterName, annotation, parameterValue, validationMessage(annotation.message(), MESSAGE_DEFAULT));
    }

    @Override
    protected String buildMessage() {
        return "parameter[" + this.getParameterIndex() + "] " + this.getParameterName() + " should not be null";
    }
}